class Solution {
public:
    string convert(string s, int n) {
        if (n < 2)return s;
        vector<string>res(n);
        int idx = 0;
        int flag = 0;
        for (auto x : s) {
            res[idx] += x;
            if (!flag) {
                idx++;
                if (idx == n - 1)flag = 1;
            }
            else {
                idx--;
                if (idx == 0)flag = 0;
            }
        }
        string ans;
        for (int i = 0; i < n; i++)ans += res[i];
        return ans;
    }
};